home *** CD-ROM | disk | FTP | other *** search
- #include "Comstream.h"
- #include "Timer.h"
- #include <Dos.h>
- #include <constream.h>
- #include <string.h>
-
- // Buffer for the stream.
- char mybuf[1024];
- char str[20];
-
- int main()
- {
- constream win; // output stream
- comstream com1( mybuf, 512, 512 ); // serial i/o stream
- int ch;
-
- win.window( 1, 1, 80, 25 );
- win.clrscr();
-
- com1.rdbuf()->setOption( HW_HANDSHAKE ); // use cts/rts handshaking
- com1.rdbuf()->setOption( WAITFORECHO ); // ensures echo
- com1.open(0); // open COM1
- com1 << baud(2400) << bits(8) << parity(combuf::none) << stopbits(1);
- // protocol to 2400-8-N-1
-
- com1 << "ATZ\r"; // Check out modem.
- com1 >> ws >> str; // This is the echo of ATZ
- if( !strnicmp( str, "ATZ", 3) )
- {
- win << str << endl;
- com1 >> ws >> str;
- }
- com1.close();
-
- win << str << endl;
- if( strnicmp( str, "OK", 2) )
- win << "Bad";
- else
- win << "GOOD!";
- win << endl;
- return 0;
- }
-
-